Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Add server subcommand and gldserver module #1292

Merged
merged 21 commits into from
May 31, 2023

Conversation

dchassin
Copy link
Member

@dchassin dchassin commented May 26, 2023

Added a new subcommand server. Suggested test procedure:

  1. Create server.glm with the following
#model get IEEE/123
#include "123.glm"
#weather get "CA-San_Francisco_Intl_Ap.tmy3"
#input "CA-San_Francisco_Intl_Ap.tmy3"
#set run_realtime=1
  1. Start the server
gridlabd server start server.glm
  1. Check that it's running
gridlabd server status
  1. Stop the server
gridlabd server stop 6267
  1. Check that it's stopped
gridlabd server status

Added a server module in python. Suggested usages:

  1. Detached mode (process is not a child of python process):
from gldserver import GridlabdServer, GldDouble, GldComplex
sim = GridlabdServer("modelname.glm",detached=True)
print(sim.get_global("version"))
objects = sim.get_objects("class=load")
power = sim.get_property(objects[0],"constant_power_A",astype=GldComplex)
sim.set_property(objects[0],"constant_power_A,power*2)
sim.stop()
  1. Attached mode (process is a child of python process) in a context:
from gldserver import GridlabdServer, GldDouble, GldComplex
with GridlabdServer("modelname.glm",detached=False) as sim:
  print(sim.get_global("version"))
  objects = sim.get_objects("class=load")
  power = sim.get_property(objects[0],"constant_power_A",astype=GldComplex)
  sim.set_property(objects[0],"constant_power_A,power*2)

@dchassin dchassin added the enhancement Request an enhancement or new feature label May 26, 2023
@dchassin dchassin added this to the TESS Initial Release milestone May 26, 2023
@dchassin dchassin requested a review from aivanova5 May 26, 2023 20:37
@dchassin dchassin self-assigned this May 26, 2023
@aivanova5 aivanova5 merged commit 8a478e2 into arras-energy:develop May 31, 2023
@aivanova5 aivanova5 mentioned this pull request Jun 1, 2023
72 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Request an enhancement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants